package org.aphasia4j.dao.impl;

import java.util.List;

import org.aphasia4j.dao.CategoryDao;
import org.aphasia4j.dao.core.BaseDaoSupport;
import org.aphasia4j.model.Category;

/**
 * Implementation of the {@link CategoryDao} interface description.
 * 
 * @author hillger.t
 */
public class CategoryDaoImpl extends BaseDaoSupport<Category> implements CategoryDao {

  @Override
  @SuppressWarnings("unchecked")
  public List<Category> getCategoriesByName(String namePart) {
    String jql = "select c from Category c where lower(c.name) like ?";
    return this.getJpaTemplate().find(jql, namePart + "%");
  }
}
